﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PopupOrganizationUser.aspx.cs" Inherits="System_PopupOrganizationUser" %>
<html>
<head>
    <title>选择部门</title>
    <meta http-equiv="Page-Enter" content="revealTrans(Duration=1.0,Transition=16)" />
    <link href="../resources/styles/style.css" type="text/css" rel="stylesheet" />

    <script src="../JavaScript/common.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
    
    function ReturnValue(NameControlId,text,ValueControlId,value,usersID,users) 
    {
        var oOption = window.opener.document.createElement('OPTION');
        //alert(window.opener.document.getElementById(NameControlId));return;
        window.opener.document.getElementById(NameControlId).value=text;
        window.opener.document.getElementById(ValueControlId).value=value;
        
        if (usersID.lenth>0)
            window.opener.document.getElementById(usersID).innerHTML=users;

        
        //window.close(); 
    } 
    
    function SingleCheck()
    {
        var obj = event.srcElement;
        if(obj.tagName=="INPUT" && obj.type=="checkbox")
        {
            if(obj.checked==true)
            {
                var chkedid=obj.id;
                //obj.nextSibling.innerText 所选复选框旁边的文本
                var inputs = document.getElementsByTagName("input");
                for(var i=0;i<inputs.length;i++)
                {   
                    if((inputs[i].type=="checkbox") && (inputs[i].id != chkedid))
                    {
                        inputs[i].checked=false;
                    }
                }

            }
        }

    }


    
    function client_OnTreeNodeChecked()
    {
        var obj = window.event.srcElement;
        var treeNodeFound = false;
        var checkedState;
        if (obj.tagName == "INPUT" && obj.type == "checkbox")
        {
            var treeNode = obj;
            checkedState = treeNode.checked;
            do
            {
                obj = obj.parentElement;
            } while (obj.tagName != "TABLE")
            var parentTreeLevel = obj.rows[0].cells.length;
            var parentTreeNode = obj.rows[0].cells[0];
            var tables = obj.parentElement.getElementsByTagName("TABLE");
            var numTables = tables.length
            if (numTables >= 1)
            {
                for (i=0; i < numTables; i++)
                {
                    if (tables[i] == obj)
                    {
                        treeNodeFound = true;
                         i++;
                         if (i == numTables)
                        {
                            return;
                        }
                }
                if (treeNodeFound == true)
                {
                    var childTreeLevel = tables[i].rows[0].cells.length;
                    if (childTreeLevel > parentTreeLevel)
                    {
                        var cell = tables[i].rows[0].cells[childTreeLevel - 1];
                        var inputs = cell.getElementsByTagName("INPUT");
                        inputs[0].checked = checkedState;
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
        }
    }

    </script>


</head>
<body>
<form runat="server">

    <div>
        <table id="wsd_inputtable">
            <tr>
                <td class="tabletitle" style="height: 21px" width="100%">
                    树状视图
                </td>
            </tr>
        </table>
        <table id="wsd_listtable">
            <tr>
                <td>
                    <div style="height: 400px; overflow-y: auto">
                        <asp:TreeView ID="TreeOrg" runat="server" ShowLines="True" 
                            onselectednodechanged="TreeOrg_SelectedNodeChanged">
                        </asp:TreeView>
                    </div>
                </td>
            </tr>
        </table>
        <br />
        <asp:Button ID="btnOK" runat="server" Text="确  定"  class=wsd_button2 onclick="btnOK_Click" UseSubmitBehavior="false" />
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input id="Button2" type="button" value="取  消"  class=wsd_button2 onclick="window.close()" />
    </div></form>
</body>
</html>